
 
 F u n c t i o n :   s e t G l o b a l ( o b j e c t K e y V a l u e M a p ,   b o o l M e r g e R e t r o a c t i v e l y ) 
 
 
 
 D e s c r i p t i o n :   S e t s   g l o b a l   p r o p e r t i e s   a n d   m e t h o d s   t h a t   w i l l   b e   p r o t o t y p e d   i n t o   a l l   n e w   D C   o b j e c t s   w h e n   r e g i s t e r e d . 
 
 
 
 R e t u r n s :   N u l l . 
 
 
 
 N o t e :   W h e n   b o o l M e r g e R e t r o a c t i v e l y   i s   s e t   t o   t r u e ,   $ A . m e r g e G l o b a l ( )   w i l l   a u t o m a t i c a l l y   b e   i n v o k e d   a f t e r   t h e   n e w   g l o b a l   p r o p e r t i e s   a n d   m e t h o d s   a r e   s a v e d .   O t h e r w i s e ,   t h e   s p e c i f i e d   p r o p e r t i e s   a n d   m e t h o d s   w i l l   o n l y   b e   p r o t o t y p e d   i n t o   n e w   D C   o b j e c t s   w h e n   r e g i s t e r e d .   T h e   s e t G l o b a l ( )   f u n c t i o n   w i l l   n o t   p r e v e n t   o r   o v e r w r i t e   t h e   l o c a l   c o n f i g u r a t i o n   o f   i n d i v i d u a l   D C   o b j e c t s . 
 
 
 
 E x a m p l e : 
 
 
 
 / /   S e t   n e w   g l o b a l   p r o p e r t i e s   a n d   m e t h o d s   f o r   u s e   w i t h i n   a l l   n e w l y   g e n e r a t e d   D C   o b j e c t s . 
 
 $ A . s e t G l o b a l ( { 
 
     p r o p s :   { 
 
         s e r v e r E n a b l e d :   t r u e , 
 
         l o a d F r o m S e r v e r :   f u n c t i o n ( )   { 
 
             v a r   d c   =   t h i s . D C ; 
 
             i f   ( d c . p r o p s . s e r v e r E n a b l e d )   { 
 
                 $ A . G e t ( { 
 
                     u r l :   " s e r v e r / a p i / j s o n ? p a r a m s " , 
 
                     d a t a :   { r e t u r n T y p e :   " j s o n " } , 
 
                     s u c c e s s :   f u n c t i o n ( j s o n ,   p r o m i s e )   { 
 
                         / /   P r o c e s s   j s o n   a n d   b u i l d   m a r k u p   t o   r e n d e r   w i t h i n   c o n t e n t   v a r . 
 
                         v a r   c o n t e n t   =   " W h a t e v e r " ;   / /   p o p u l a t e   w i t h   J S O N   d a t a   h o w e v e r . 
 
                         / /   S e t   c o n t e n t   a s   s o u r c e   f o r   t h e   c u r r e n t   D C   o b j e c t . 
 
                         d c . c o n t e n t   =   c o n t e n t ; 
 
                         / /   P r e v e n t   t h i s   o b j e c t   f r o m   c o n t a c t i n g   t h e   s e r v e r   a   s e c o n d   t i m e   i f   s u c c e s s f u l . 
 
                         d c . p r o p s . s e r v e r E n a b l e d   =   f a l s e ; 
 
                         / /   N o w   r e n d e r   t h e   D C   o b j e c t   a n d   d i s p l a y   t h e   n e w   d a t a . 
 
                         d c . r e n d e r ( ) ; 
 
                     } 
 
                 } ) ; 
 
             } 
 
             r e t u r n   d c ; 
 
         } 
 
     } 
 
 } ) ; 
 
 
 
 / /   S e t   n e w   g l o b a l   p r o p e r t i e s   a n d   m e t h o d s   f o r   u s e   w i t h i n   a l l   g e n e r a t e d   D C   o b j e c t s ,   i n c l u d i n g   p r e v i o u s l y   i n s t a n t i a t e d   o n e s . 
 
 $ A . s e t G l o b a l ( { 
 
     p r o p s :   { 
 
         s e r v e r E n a b l e d :   t r u e , 
 
         l o a d F r o m S e r v e r :   f u n c t i o n ( )   { 
 
             v a r   d c   =   t h i s . D C ; 
 
             i f   ( d c . p r o p s . s e r v e r E n a b l e d )   { 
 
                 / /   D o   s o m e t h i n g   a s   s h o w n   a b o v e ,   t h e n   r e n d e r   u s i n g   d c . r e n d e r ( ) . 
 
             } 
 
             r e t u r n   d c ; 
 
         } 
 
     } 
 
 } ,   t r u e ) ; 
 
 